package com.example.cshaoshao.testall.activities;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.example.cshaoshao.testall.R;
import com.example.cshaoshao.testall.adapters.MultipleItemAdapter;
import com.example.cshaoshao.testall.entities.MultipleItem;

import java.util.ArrayList;

/**
 * Created by cshaoshao on 2017/9/3.
 */

public class BrvahActivity extends AppCompatActivity {
    RecyclerView recyclerView;
    private ArrayList<MultipleItem> totalist;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.bravh_layout);
        recyclerView= (RecyclerView) findViewById(R.id.recycler);
        initData();
        bindData();
    }

    private void bindData() {
        recyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false));
        MultipleItemAdapter adapter=new  MultipleItemAdapter(totalist);
        recyclerView.setAdapter(adapter);
//       adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener()
//       {
//           @Override
//           public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
//               Toast.makeText(BrvahActivity.this,"你点击了"+position,Toast.LENGTH_SHORT).show();
//           }
//       });
    }

    private void initData() {
        totalist=new ArrayList<>();
        totalist.add(new MultipleItem(MultipleItem.Type_1));
        totalist.add(new MultipleItem(MultipleItem.Type_2));
        totalist.add(new MultipleItem(MultipleItem.Type_3));
        totalist.add(new MultipleItem(MultipleItem.Type_4));
        totalist.add(new MultipleItem(MultipleItem.Type_1));
        totalist.add(new MultipleItem(MultipleItem.Type_2));
        totalist.add(new MultipleItem(MultipleItem.Type_3));
        totalist.add(new MultipleItem(MultipleItem.Type_4));
        totalist.add(new MultipleItem(MultipleItem.Type_1));
        totalist.add(new MultipleItem(MultipleItem.Type_2));
        totalist.add(new MultipleItem(MultipleItem.Type_3));
        totalist.add(new MultipleItem(MultipleItem.Type_4));
        totalist.add(new MultipleItem(MultipleItem.Type_1));
        totalist.add(new MultipleItem(MultipleItem.Type_2));
        totalist.add(new MultipleItem(MultipleItem.Type_3));
        totalist.add(new MultipleItem(MultipleItem.Type_4));
    }
}
